package com.artislong;

import com.artislong.servlet.McpServerServlet;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.startup.Tomcat;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author 陈敏
 * @version TomcatApplication.java, v 1.0 2025 07 07 09:33 chenmin Exp $
 * Created on 2025 07 07
 */
public class McpServerTomcatApplication {

    public static void main(String[] args) {
        Tomcat tomcat = TomcatUtil.createTomcatServer("/mcp", 8080, new McpServerServlet());
        try {
            tomcat.start();
            assertThat(tomcat.getServer().getState()).isEqualTo(LifecycleState.STARTED);
            System.out.println("Tomcat started");
            tomcat.getServer().await();
        } catch (Exception e) {
            throw new RuntimeException("Failed to start Tomcat", e);
        }
    }

}
